{% load comments %}
<table class="table_noborder" cellpadding="0" cellspacing="0" border="0" width="100%" id="id_table_cases" >
	<tr>
		<th align="left" class="sortcol sortdesc" width="60" >Case ID</th>
		<th align="left" class="sortcol" width="100">Case Run ID</th>
		<th align="left" class="sortcol">Summary</th>
		<th align="left" class="sortcol" width="150">Category</th>
		<th align="left" class="sortcol" width="120">Tester</th>
		<th align="left" class="sortcol" width="120">Bugs</th>
		<th align="left" class="sortcol" width="200">Last Execution Time</th>
	</tr>
	{% for test_case_run, bugs, comments in case_runs %}
	<tr>
		<td valign="top"><a href="{% url 'testcases-get' test_case_run.case_id %}">{{ test_case_run.case.pk }}</a></td>
		<td valign="top"><a href="{% url 'testruns-get' test_case_run.run_id %}#caserun_{{ test_case_run.pk }}">{{ test_case_run.pk }}</a></td>
		<td valign="top">{{ test_case_run.case.summary }}</td>
		<td valign="top">{{ test_case_run.case.category }}</td>
		<td valign="top">{{ test_case_run.tested_by }}</td>
		<td valign="top">
		{% for bug in bugs %}
			<a href="{{ bug.get_full_url }}">{{ bug }}</a>,
		{% empty %}
			<span class="grey"></span>
		{% endfor %}
		</td>
		<td valign="top" >{{ test_case_run.close_date }}</td>
	</tr>

	{% if comments %}
		<tr>
			<td colspan="7">Comments:</td>
		</tr>
		{% for comment in comments %}
		<tr class="border-bottom">
			<td valign="top" colspan="7">{{ comment.comment|urlize|linebreaksbr }}<span class="grey">[{{ comment.user__username }} {{ comment.submit_date }}]</span></td>
		</tr>
		{% endfor %}
	{% endif %}

	{% if test_case_run.bug.count %}
	<tr>
		<td colspan="7">Bugs:</td>
	</tr>
	{% endif %}
	{% for bug in test_case_run.bug.all %}
	<h1>bottom bugs</h1>
	<tr class="border-bottom">
		<td valign="top" colspan="7"><a href="{{ bug.get_full_url }}">{{ bug }}</a> </td>
	</tr>
	{% endfor %}

	{% empty %}
	<tr><td align="center" colspan="7"><span class="grey">No data.</span></td></tr>
	{% endfor %} {# end of looping case runs #}
</table>
